package com.cg.design.graphicdesignpattern.iterator;

import org.junit.Test;

/**
 * 测试类
 *
 * @program: LeetCode->IteratorTest
 * @description: 测试类
 * @author: cg
 * @create: 2022-03-17 21:55
 **/
public class IteratorTest {
    @Test
    public void testIterator() {
        BookShelf bookShelf = new BookShelf(4);
        bookShelf.appendBook(new Book("白鹿原"));
        bookShelf.appendBook(new Book("罪与罚"));
        bookShelf.appendBook(new Book("一句顶一万句"));
        bookShelf.appendBook(new Book("坏小孩"));
        Iterator<Book> iterator = bookShelf.iterator();
        while (iterator.haxNext()) {
            System.out.println(iterator.next().getName());
        }
    }
}
